#ifndef VAction_H
#define VAction_H					 

///////////////////////////////////////////////////////////////////////////////

class VAction : public QAction
{
	Q_OBJECT
	
public:
	VAction(QObject *parent) :QAction(parent) { cs();}
	VAction(const QString &text,QObject *parent) :QAction(text,parent) { cs();}
	VAction(const QIcon &icon,const QString &text,QObject *parent) :QAction(icon,text,parent) { cs();}
	~VAction() {}

signals:
	void triggered(QAction *action);

private slots:
	void slot_triggered() { emit triggered(this);}
	
private:
	void cs()	{	connect( this,SIGNAL(triggered(bool)), this,SLOT(slot_triggered()) );}
};

/******************************************************************************
///////////////////////////////////////////////////////////////////////////////

template <class EAction> class VActionsEx
{
public:
	VActionsEx() :m_toolBar(NULL) {}
	~VActionsEx() { delete m_toolBar;}

	QToolBar *tooBar() 
	{
		if (!m_toolBar) {
			m_toolBar = new QToolBar;
		}
		return m_toolBar;
	}
	
	void addAction(EAction eAction,VAction *action)
	{
		m_actions[eAction] = action;
		connect(action,SIGNAL(triggered(QAction *)), this,SLOT(triggered(QAction *)));
	}
	
	VAction *action(EAction eAction) const { return m_actions[eAction];}
	
signals:
	void triggered(QAction *action);
	
private:
	QHash<EAction,VAction*> m_actions;
	QToolBar *m_toolBar;
};
******************************************************************************/

///////////////////////////////////////////////////////////////////////////////

#endif
